import * as types from './mutation-types'
import Vue from 'vue'

const mutations = {
  [types.TEST] (state, data) {
    state.test = data
  },
  [types.SET_SNAP_SHOOT_LINE] (state, {line1, line2, lineY, name1, name2}) {
    state.snapShootLine = {snapShootLine1: line1, snapShootLine2: line2, lineY: lineY, name1: name1, name2: name2}
  },
  [types.SET_ROBOT_ID] (state, id) {
    // state.robot_id = id
    Vue.set(state, 'robot_id', id)
  },
  [types.SET_MODEL_LIST] (state, list) {
    // state.modelList = list
    Vue.set(state, 'modelList', list)
  },
  [types.SET_PREVIEW_DATA] (state, list) {
    let data = list
    let data2 = []
    data.forEach(item => {
      let d = ['']
      d.push(item.open_rate)
      d.push(item.close_rate)
      d.push(item.high_rate)
      d.push(item.low_rate)
      data2.push(d)
    })
    Vue.set(state, 'previewData', data2)
  }
}

export default mutations
